//
//  Util.m
//  iengage
//
//  Created by Luis Ziliani on 2/12/09.
//  Copyright 2009 Manas. All rights reserved.
//

#import "Util.h"


@implementation NSString (Util)

+ (BOOL) isNullOrEmpty: (NSString*) string {
	return string == nil || [string length] == 0;
}

- (NSString*) toHTML {
	return [[self stringByReplacingOccurrencesOfString:@"&" withString:@"&amp;"]
				  stringByReplacingOccurrencesOfString:@"<" withString:@"&lt;"];
}

@end


@implementation UIAlertView (Utils)

+ (void) showWithTitle: (NSString *)title message: (NSString *) msg dismissButton: (NSString *) buttonLabel {
	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
													message: msg
												   delegate:nil 
										  cancelButtonTitle:buttonLabel
										  otherButtonTitles:nil, nil];
	[alert autorelease];
	[alert show];
}

+ (void) showWithTitle: (NSString *)title message: (NSString *) msg {
	[self showWithTitle: title message: msg dismissButton: nil];
}
@end
